<?php

namespace app\common\model;

use think\Model;

class BehaviorLog extends Model {

    /**
     * 定义主键
     * @var string
     */
    protected $pk = 'bl_id';
    
    public function addLog($params) {
        $date = date('Y年m月d日H时i分s秒');
        $message = '用户"'.$params['username']. '"在' .$date. $params['message'];
        $data = [
            'bl_controller'  => $params['controller'],
            'bl_action'      => $params['action'],
            'bl_message'     => $message,
            'bl_member_id'   => $params['memberId'],
            'bl_create_time' => date('Y-m-d H:i:s')
        ];
        $this->insert($data);
    }
}